package memcached;

import java.io.*;
import java.net.InetSocketAddress;
import java.net.Socket;

public class Test {
    public static void main(String[] args) throws IOException {
        Socket socket = new Socket();
        socket.connect(new InetSocketAddress(11211));
        OutputStreamWriter osw = new OutputStreamWriter(socket.getOutputStream());
        BufferedWriter bw = new BufferedWriter(osw);
        bw.write("get foo foo1");
        bw.newLine();
        bw.flush();
        BufferedReader br = new BufferedReader(new InputStreamReader(socket.getInputStream()));
        String tmp = null;
        while ((tmp = br.readLine()) != null) {
            System.out.println(tmp);
            if("END".equalsIgnoreCase(tmp)){
                break;
            }
        }

        socket.close();
    }
}
